<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ page import="java.util.*" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>

<html>
  <head>
  	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>Diskuze</title>
  </head>
  <body>
<h1>Diskuze</h1>   
    <table>
      <th>Datum</th><th>Obsah</th>        <th></th>
      <c:forEach items="${posts}" var="current">
        <tr>
          <td><c:out value="${current.getCreated()}" /><td> 
          <td><c:out value="${current.getContent()}" /><td> 
          <td> <a href="thread.html?id=${posts.indexOf(current)}"><input type="button" value="Odstranit" /></a></td>      
        </tr>
      </c:forEach>
    </table>
    
    
    <form:form commandName="post" action="thread.html" method="post">
    <table>
        <tr>
           <td><form:label path="content">bla:</form:label></td>
            <td><form:input path="content" /></td>
            <td><form:errors path="content" cssClass="error" /></td>
        </tr> 
    </table>
    
    <input type="submit" value="Vytvořit" />
    <a href="list"><input type="button" value="Zrušit" /></a>
</form:form>
    
    
    
  </body>
</html>
